#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <sstream>

void split(std::string str, char delimiter, std::vector<std::string> &tokens)
{
    std::string token;
    std::istringstream iss(str);
    while (std::getline(iss, token, delimiter))
    {
        tokens.push_back(token);
    }
}

int main()
{
    std::string mem_str;
    std::cin >> mem_str;
    std::vector<std::string> mem_tokens;
    split(mem_str, ',', mem_tokens);

    std::string num_str;
    std::cin >> num_str;
    std::vector<std::string> num_tokens;
    split(num_str, ',', num_tokens);

    std::map<int, int> mem_map;
    for (int i = 0; i < mem_tokens.size(); i++)
    {
        std::vector<std::string> tks;
        split(mem_tokens[i], ':', tks);
        mem_map[std::stoi(tks[0])] = std::stoi(tks[1]);
    }

    std::vector<bool> suc;
    for (int i = 0; i < num_tokens.size(); i++)
    {
        int num = std::stoi(num_tokens[i]);
        bool ff = false;
        for (auto it = mem_map.begin(); it != mem_map.end(); it++)
        {
            if (num <= it->first)
            {
                it->second--;
                if (it->second <= 0)
                {
                    mem_map.erase(it);
                }
                ff = true;
                break;
            }
        }
        suc.push_back(ff);
    }

    for (int i = 0; i < suc.size() - 1; i++)
    {
        if (suc[i])
            std::cout << "true,";
        else
            std::cout << "false,";
    }
    if (suc.back())
        std::cout << "true\n";
    else
        std::cout << "false\n";

    return 0;
}